<template>
	<view class="content" :style="{ height: windowHeight + 'px' }">
		<view class="buttons" @click="submits">
			电话客服
		</view>
	</view>
</template>

<script>
	import {
		systemInfo
	} from '../../utils/mixin'
	import {
		addFeedback,
		listPhone
	} from '@/api/index.js'
	export default {
		components: {},
		mixins: [systemInfo],
		data() {
			return {

			}
		},
		async onLoad() {
			// 状态栏高度
			this.getSystemInfo();

		},
		methods: {
			async submits() {

				const response = await listPhone()
				// #ifdef APP-PLUS
				//安卓手机手动设置一个showActionSheet
				if (response.code == 200) {
					uni.showActionSheet({
						itemList: ['phone', '呼叫'],
						success: function(res) {
							if (res.tapIndex == 1) {
								uni.makePhoneCall({
									phoneNumber: response.rows[0].phone,
								})
							}
						}
					})
				}
				// #endif
				// #ifdef MP-WEIXIN
				if (response.code == 200) {
					uni.makePhoneCall({
						phoneNumber: response.rows[0].phone, // 替换为你要拨打的电话号码
						success: () => {
							console.log('拨打电话成功！');
						},
						fail: () => {
							console.error('拨打电话失败！');
						}
					});
				}
				// #endif
			},
		}
	}
</script>

<style lang="less" scoped>
	.content {
		background-color: #fff;
		width: 100%;
		box-sizing: border-box;
		background: url('https://dujiaojing.oss-cn-huhehaote.aliyuncs.com/uploads/2025/7/29/1753758589487_046d8e65/%E5%AE%A2%E6%9C%8D%E7%94%B5%E8%AF%9D%E8%83%8C%E6%99%AF%E5%9B%BE%5B1%5D.jpg?x-oss-process=image/resize,w_300') no-repeat;
		background-size: 100% 100%;
		position: relative;

		.buttons {
			width: 300rpx;
			height: 80rpx;
			background-color: rgba(254, 0, 0);
			color: #fff;
			line-height: 80rpx;
			text-align: center;
			font-size: 36rpx;
			border-radius: 10rpx;
			letter-spacing: 20rpx;
			position: absolute;
			top: 60%;
			left: 50%;
			transform: translateX(-50%);
		}


	}
</style>